import request from '@/utils/request';

// 获取排班列表
export function getNIScheduleList(params) {
  return request({
    url: '/nurseRoundsSchedule/list',
    method: 'get',
    params,
  });
}

// 排班保存
export function saveNISchedule(data) {
  return request({
    url: '/nurseRoundsSchedule/add',
    method: 'post',
    data,
  });
}

// 导出排班
export function exportTemplate(data) {
  return request({
    url: '/nurseRoundsSchedule/exportTemplate',
    method: 'post',
    data,
    responseType: 'arraybuffer',
  });
}

// 导入排班
export function importTemplate(data) {
  const { yardCode, file } = data;
  return request({
    url: '/nurseRoundsSchedule/importTemplate',
    method: 'post',
    params: { yardCode },
    data: file,
  });
}

// 排班发布
export function publish(data) {
  return request({
    url: '/nurseRoundsSchedule/publish',
    method: 'post',
    data,
  });
}

// 取消排班发布
export function cancelPublish(params) {
  return request({
    url: '/nurseRoundsSchedule/cancel',
    method: 'post',
    params,
  });
}
